package com.fwpsl.spring.test;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class Sender {

    private static final Logger log = LoggerFactory.getLogger(Sender.class);

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void helloSend() {
        String context = "hello " + new Date();
        log.warn("Sender : " + context);
        this.amqpTemplate.convertAndSend("hello ", context);
    }

    public void fwServerSend() {
        String context = "fwpsl " + new Date();
        log.warn("Sender : " + context);
        this.amqpTemplate.convertAndSend("fwpsl ", context);
    }

    public void testSend() {
        String context = "test " + new Date();
        log.warn("Sender : " + context);
        this.amqpTemplate.convertAndSend("test ", context);
    }
}
